<?php /*a:2:{s:83:"/www/wwwroot/survey.sdwanyue.com/public/themes/admin_simpleboot3/admin/ask/add.html";i:1617869019;s:83:"/www/wwwroot/survey.sdwanyue.com/public/themes/admin_simpleboot3/public/header.html";i:1610676092;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- HTML5 shim for IE8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <![endif]-->


    <link href="/themes/admin_simpleboot3/public/assets/themes/<?php echo cmf_get_admin_style(); ?>/bootstrap.min.css" rel="stylesheet">
    <link href="/themes/admin_simpleboot3/public/assets/simpleboot3/css/simplebootadmin.css" rel="stylesheet">
    <link href="/static/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        form .input-order {
            margin-bottom: 0px;
            padding: 0 2px;
            width: 42px;
            font-size: 12px;
        }

        form .input-order:focus {
            outline: none;
        }

        .table-actions {
            margin-top: 5px;
            margin-bottom: 5px;
            padding: 0px;
        }

        .table-list {
            margin-bottom: 0px;
        }

        .form-required {
            color: red;
        }
    </style>
    <script type="text/javascript">
        //全局变量
        var GV = {
            ROOT: "/",
            WEB_ROOT: "/",
            JS_ROOT: "static/js/",
            APP: '<?php echo app('request')->module(); ?>'/*当前应用名*/
        };
    </script>
    <script src="/themes/admin_simpleboot3/public/assets/js/jquery-1.10.2.min.js"></script>
    <script src="/static/js/wind.js"></script>
    <script src="/themes/admin_simpleboot3/public/assets/js/bootstrap.min.js"></script>
    <script>
        Wind.css('artDialog');
        Wind.css('layer');
        $(function () {
            $("[data-toggle='tooltip']").tooltip({
                container:'body',
                html:true,
            });
            $("li.dropdown").hover(function () {
                $(this).addClass("open");
            }, function () {
                $(this).removeClass("open");
            });
        });
    </script>
    <?php if(APP_DEBUG): ?>
        <style>
            #think_page_trace_open {
                z-index: 9999;
            }
        </style>
    <?php endif; ?>
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li><a href="<?php echo url('ask/index',['listid'=>$listid,'status'=>$status]); ?>">问卷题目</a></li>
        <li class="active"><a href="<?php echo url('ask/add',['listid'=>$listid]); ?>">添加</a></li>
    </ul>
    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="<?php echo url('ask/addPost'); ?>">
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">题干<span class="form-required">*</span></label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-name" name="title">
            </div>
        </div>
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">选项个数(正整数)<span class="form-required">*</span></label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-count" name="count_option" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}">
            </div>
        </div>	
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">最多可选(正整数)<span class="form-required">*</span></label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-name" name="count_max" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}">
            </div>
        </div>		
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">最少可选(正整数)<span class="form-required">*</span></label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-name" name="count_min" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^0-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}">
            </div>
        </div>	
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">选项<span class="form-required">*</span></label>
            <div class="col-md-6 col-sm-10" id="options">

            </div>
        </div>	



        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
				<input type="hidden" class="form-control" name="listid" value="<?php echo $listid; ?>">
                <button type="submit" class="btn btn-primary js-ajax-submit"><?php echo lang('ADD'); ?></button>
                <a class="btn btn-default" href="<?php echo url('ask/index',array('listid'=>$listid,'status'=>$status)); ?>"><?php echo lang('BACK'); ?></a>
            </div>
        </div>
    </form>
</div>
<script src="/static/js/admin.js"></script>


<script type="text/javascript">

    $(function () {

        $("#input-count").on("change",function(){
            html='';
            var count = $(this).val();
            for(i=0;i<count;i++){
                var thumbId = '#thumbnail' + i;
                html+='<input type="text" class="form-control" id="input-name" name="option[]" style="margin-bottom:3px">';
                html+= '<input type="hidden" name="thumb' + i + '"' + ' id=thumbnail' + i;
                html+= ' value="">';
                html+= '<a href="javascript:uploadOneImage(' + "'" + '图片上传' + "'," + "'" + thumbId + "'" + ');">';
                html+= '<img src="/themes/admin_simpleboot3/public/assets/images/default-thumbnail.png"';
                html+= 'id="thumbnail' + i + '-preview"';
                html+= 'style="cursor: pointer;max-width:100px;max-height:100px;"/>';
                html+= '</a>';
                html+= '<input type="button" onclick="cancelThumb(' + i +')" class="btn btn-sm btn-cancel-thumbnail' + i + '" value="取消图片">';
            }
            $("#options").html(html);
        });

    });


    function cancelThumb(i) {
        $("#thumbnail" + i + "-preview").attr('src','/themes/admin_simpleboot3/public/assets/images/default-thumbnail.png');
        $("#thumbnail" + i).val('');
    }







</script>
</body>
</html>